<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.lp.cfg.ProConfig"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/WEB-INF/oss/iot/common/variable.jsp"%>
<%@ include file="/WEB-INF/oss/iot/common/variable_js.jsp"%>
<%@ include file="/WEB-INF/oss/iot/common/resource_lib.jsp"%>

<style type="text/css">
	.app-container{
		width: 100%;border-top:1px solid #ecf0f5;
		padding-top: 10px;
	}
	.box-white {
	    width: 97%;
	    min-width: 897px;
	    padding-bottom: 0;
	    margin: 0 auto;
	}
	.box {
	    padding: 10px;
	    border: 0!important;
	    position: relative;
	    border-radius: 3px;
	    background: #fff;
	    margin-bottom: 20px;
		margin: 0 auto;
	}
	.List-info{
		padding-top: 10px;
		padding-left: 10px;
	}
</style>
</head>
<body>
	<div>
		<div>
			<div class="mapContainer" >
				<div class="app-container">
					<div class="container-layout List-info">
						<div class="box join-device-box">
							<div class="clearfix" style="width: 600px;margin: 0 auto;">
								<div>
									<div class="ml-20" id="form_submit_add" config-option=" url:'/visual/display',
																			   submit:'.add-Btn',
																			   success:'sunccessReturn' " >
										<div id="form_submit_update"  config-option=" url:'/visual/display','method':'put',
																			   submit:'.add-Btn',
																			   success:'sunccessReturn' " >
											<div id="detail_get" config-option=" 'url':'/visual/display?id=$#init-id$' ">
												<input id="init-id" type-name="id" type="hidden">
												
												<div class="form-line">
													<span class="red">*</span>&nbsp;<span>可视化名称：</span>
													<div class="pb-10 pt-10">
														<input placeholder="名称" validate="empty" type-name="name" class="input input-big" >
													</div>
												</div>
												
												<div class="form-line">
													<span class="red">*</span>&nbsp;<span>类型：</span>
													<div class="pb-10 pt-10">
														<select type-name="dis_type" class="input input-big input-select" >
															<option value="0">电脑组态</option>
															<option value="1">手机组态</option>
														</select>
													</div>	
												</div>
												
												<div class="form-line hide scene_part">
													<span class="red">*</span>&nbsp;<span>项目名称：</span>
													<div class="pb-10 pt-10">
														<select type-name="scene_id" class="input input-big input-select scene_id"  type-option="selecter" 
																config-option="'method':'POST','url':'/page/scene?pageSize=100&paged=1',data:{},success:'successfunc','init_value':'请选择设备协议','key':'id','value':'name','type':'page' "  >
															
														</select>
													</div>	
												</div>
												
												<div class="form-line">
													<span class="red">*</span>&nbsp;<span>描述：</span>
													<div class="pb-10 pt-10">
														<input placeholder="描述" type-name="description" class="input input-big" >
													</div>	
												</div>
												
												<div class="form-line">
													<span class="red">*</span>&nbsp;<span>排序：</span>
													<div class="pb-10 pt-10">
														<input placeholder="显示顺序" value="1" type="number" validate="empty" type-name="seq" class="input input-big" >
													</div>	
												</div>
												
<!-- 												<input type="hidden" class="scene_id" type-name="scene_id"  > -->
												<input type="hidden" class="keycode" type-name="keycode"  >
												
												<div class="form-line clearfix  pb-10">
													<button onclick="parent.layer.close(index);" style="background: #aaa;" class="cancel-btn layui-btn ml-20 border-gray float-right">取消</button>
													<button class="add-Btn  ml-10 float-right layui-btn layui-btn-normal">保存</button>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>

<script type="text/javascript">

//获取窗口索引
var index = parent.layer.getFrameIndex(window.name); 

function sunccessReturn(){
	tip("成功");
	
	setTimeout(function() {
		parent.layer.close(index);
		parent.app.initVisual() ;
	}, 1000);
}

function successfunc(){
	var scene_id = $('.scene_id', parent.document).val(); 
	$(".scene_id").val( scene_id ) ;
}

$(function(){
	// 初始化url参数
	var id = GetQueryString("id");
	if(validater.empty(id)){
		manual_form_submit($("#form_submit_add"))
	}else{
		
		writeVal("init-id",id);
		manual_form_submit($("#form_submit_update"));
		manual_init_detail_get($("#detail_get"));
	}
	
	// 
	var keycode = GetQueryString("keycode") ;
	if(keycode != null && keycode != ''){
		$(".keycode").val(keycode);
		$(".scene_part").show();
	}
})

</script>
</html>